import service from '@/api/index'
import type { IUploadFile } from '../type'

/**
 * 获取认证配置
 */
export function getAuthConfig(data: any) {
  return service.post('/sso/getAuthConfig', data)
}

/**
 * 获取uuid和captchaAppId
 */
export function getCodeConfig(data: any) {
  return service.post('/sso/disposeVerification', data)
}

/**
 * 登录
 */
export function loginRequset(data: any) {
  return service.post('/sso/login', data)
}

/**
 * 获取权限路由
 */
export function getAuthRoutes() {
  return service.get('/getBaseRouters')
}

/**
 * 上传图片
 */
export function uploadFile(params: IUploadFile) {
  const formData = new FormData()
  Object.keys(params).forEach((key) => {
    formData.append(key, params[key as keyof typeof params])
  })
  return service.post('/common/upload', formData, { type: 'formData' })
}
